package com.ttl.sbgl.loginback.entity;

import jakarta.persistence.*;
import java.time.LocalDateTime;

//二维码token实体
@Entity
@Table(name = "qr_tokens")
public class QrToken {
    @Id
    private String token;
    
    private String status; // PENDING, CONFIRMED, EXPIRED
    
    private LocalDateTime createTime;
    
    private LocalDateTime expireTime;
    
    private String userName; // 扫码确认的用户名
    
    public QrToken() {
    }
    
    public QrToken(String token) {
        this.token = token;
        this.status = "PENDING";
        this.createTime = LocalDateTime.now();
        this.expireTime = LocalDateTime.now().plusMinutes(5); // 5分钟过期
    }
    
    // Getters and Setters
    public String getToken() {
        return token;
    }
    
    public void setToken(String token) {
        this.token = token;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    
    public LocalDateTime getExpireTime() {
        return expireTime;
    }
    
    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }
    
    public String getUserName() {
        return userName;
    }
    
    public void setUserName(String userName) {
        this.userName = userName;
    }
}
